<template>
  <div>
    <div>
      <el-input
          style="width: 300px; margin-right: 10px"
          prefix-icon="el-icon-search"
          v-model="patient"
          @keydown.enter.native="initTreatInfo"
          clearable
          @clear="initTreatInfo"
          @input="initTreatInfo"
          placeholder="请输入您的姓名"
      ></el-input>
      <el-input
          style="width: 300px; margin-right: 10px"
          prefix-icon="el-icon-search"
          v-model="patientIdCard"
          @keydown.enter.native="initTreatInfo"
          clearable
          @clear="initTreatInfo"
          @input="initTreatInfo"
          placeholder="请输入您的身份证号"
      ></el-input>
    </div>
    <el-table :data="treatInfomations" stripe border style="width: 100%;margin-top: 5px">
      <el-table-column prop="name" label="姓名" width="80" fixed></el-table-column>
      <el-table-column prop="gender" label="性别" width="70"></el-table-column>
      <el-table-column prop="idCard" label="身份证" width="100"></el-table-column>
      <el-table-column prop="illness" label="病因" width="100"></el-table-column>
      <el-table-column prop="nation.name" label="民族" width="70"></el-table-column>
      <el-table-column prop="politicsStatus.name" label="政治面貌"></el-table-column>
      <el-table-column prop="roomPrice.name" label="病房类型"></el-table-column>
      <el-table-column prop="roomPrice.price" label="病房价格"></el-table-column>
      <el-table-column prop="medicinePrice.medicineName" label="药物名称"></el-table-column>
      <el-table-column prop="medicinePrice.price" label="药物价格"></el-table-column>
      <el-table-column prop="allDetails.allDetails" label="总计" width="70" fixed="right"></el-table-column>
    </el-table>
    <div style="display: flex; justify-content: flex-end">
      <el-pagination
          background
          @current-change="currentChange"
          @size-change="sizeChange"
          layout=" sizes,prev, pager, next, jumper, ->, total, slot"
          :total="total"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  name: 'StaScore',
  data() {
    return {
      total: 0,
      pageCurrent: 1,
      pageSize: 10,
      treatInfomations: [],
      patient:'',
      patientIdCard:'',
    }
  },
  methods: {
    initTreatInfo() {
      this.getRequest('/patient/treatInfo/?pageCurrent='+this.pageCurrent+'&pageSize'+this.pageSize+'&name='+this.patient+'&idCard='+this.patientIdCard).then((resp) => {
        if (resp) {
          this.treatInfomations = resp.data
          this.total = resp.total
        }
      })
    },
    currentChange(currentPage) {
      this.pageCurrent = currentPage
      this.initTreatInfo()
    },
    sizeChange(pageSize){
      this.pageSize = pageSize
      this.initTreatInfo()
    }
  },
  mounted() {
    this.initTreatInfo()
  }
}
</script>

<style>

</style>